import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
import './styles/index.scss'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'

const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(ElementPlus, {
  locale: zhCn,
})
app.use(createPinia())
app.use(router)

// 导入Mock模拟数据
// 根据环境变量判断是否启用Mock
// 禁用Mock数据，使用真实API
// if (import.meta.env.VITE_USE_MOCK === 'true' || !import.meta.env.VITE_API_URL) {
//   import('./mock/index.js')
//   console.log('Mock服务已启用')
// }

console.log('使用真实API服务')

app.mount('#app') 